const mixins = require('../../mixins/forum')
const common = require('../../mixins/common')
import config from "../../api/config";
const app = getApp()
const options = {


  /**
   * 页面的初始数据
   */
  data: {
    descMaxLength: 1000,
    nameMaxLength: 80,
    descLength: 0,
    nameLength: 0,
    index: 0,
    cats: [],
    circleName: "",
    circleDesc: "",
    imagesubject: null,
    currentConfig: config.currentConfig,
    type: 'forum',
    protocolChecked: false
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.getCircleLists({
      parent: 0,
    });
  },


  /** 添加图片 */

  addimage: function () {
    this.addPictures(1);
  },

  /**监听用户输入 */
  onInputChange: function (t) {
    console.log(t);
    var a = t.currentTarget.dataset.type,
      o = t.detail.value;
    if (1 == a) this.setData({
      circleName: o,
      nameLength: o.length
    });
    else if (2 == a) this.setData({
      circleDesc: o,
      descLength: o.length
    });
  },
  /**选择圈子分类 */
  bindPickerChange: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      index: e.detail.value,
      parent: this.data.cats[e.detail.value].id,
    })
  },

  /**同意圈主协议 */
  onProtocolChange: function () {
    this.setData({
      protocolChecked: !this.data.protocolChecked
    })
  },
  
  /**查看圈主协议 */
  onProtocolClick: function () {
    wx.navigateTo({
      url: '/pages/circle/Protocol',
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
}

mixins(options)
common(options)
Page(options)